import 'dart:convert';
import 'dart:io' show File;

import 'package:aws_lambda_dart_runtime/aws_lambda_dart_runtime.dart';
import "package:test/test.dart";

final file = 'data/cloudwatch_log_event.json';

final String contents = new File(file).readAsStringSync();
final Map<String, dynamic> json = jsonDecode(contents);

void main() {
  group("cloudwatch_log_default", () {
    test("json got parsed and creates an event", () async {
      final event = AwsCloudwatchLogEvent.fromJson(json);

      expect(
          event.awslogs,
          equals({
            "data":
                "H4sIAAAAAAAAAHWPwQqCQBCGX0Xm7EFtK+smZBEUgXoLCdMhFtKV3akI8d0bLYmibvPPN3wz00CJxmQnTO41whwWQRIctmEcB6sQbFC3CjW3XW8kxpOpP+OC22d1Wml1qZkQGtoMsScxaczKN3plG8zlaHIta5KqWsozoTYw3/djzwhpLwivWFGHGpAFe7DL68JlBUk+l7KSN7tCOEJ4M3/qOI49vMHj+zCKdlFqLaU2ZHV2a4Ct/an0/ivdX8oYc1UVX860fQDQiMdxRQEAAA=="
          }));
    });
  });
}
